import datetime
import os

xdt = datetime.datetime.utcnow()
xdt = xdt.replace(tzinfo=datetime.timezone.utc)
print(xdt.isoformat())

xcwd = os.getcwd()
xroot = os.path.join(xcwd, __file__[:-3] + '.tmp.dir')
xdir = os.path.join(xroot, f'{xdt.year:04d}', f'{xdt.month:02d}', f'{xdt.day:02d}', f'{xdt.hour:02d}')
if not os.path.exists(xdir):
    os.makedirs(xdir)

FMT = '%Y-%m-%d %H_%M'
xfilename = xdt.strftime(FMT)
xfile = open(os.path.join(xdir, xfilename), 'a')
xfile.write(xdt.isoformat() + '\n')
xfile.close()
